<?php include "top.php"; ?>
<script src="uploadify/swfobject.js"  language="javascript" ></script>
<script src="uploadify/jquery.uploadify.v2.1.4.min.js"  language="javascript" ></script>
<link href="uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<?php
		 $nid=make_safe($_GET["nid"]); 
		 $BigClassName=make_safe($_GET["BigClassName"]); 
		 
		 if($nid==""){$nid=1;}		 
		if($nid==1){$nidname="公司樣本";}
		 if($nid==2){$nidname="禮服";}
		 if($nid==3){$nidname="客戶";}
		 
		 
		?>


      <div id="top-3">
        <div id="m-text-1">
        <table border="0" cellpadding="0" cellspacing="0" class="tab-5">
   <tr>
     <td valign="top"><div class="tab-5-tit">主功能列表</div>
     <div class="m-text-2_btn"><a href="category.php?nid=<?php echo $nid;?>">作品分類管理</a></div>
     <div class="m-text-2_btn"><a href="target.php?nid=<?php echo $nid;?>" >標簽管理</a></div>
        <div class="tab-5-tit">相簿管理</div>
      
	 
	 <?php
  $n=1;

  $sql="select * from product_type_big where nid='$nid' order by orderid  ";			
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
	?>
     <div class="m-text-2_btn"><a href="working.php?nid=<?php echo $nid;?>&BigClassName=<?php echo urlencode($row->BigClassName);?>"><?php echo $row->BigClassName;?></a></div>
     <?php }?>
	
	
	
       </td>
   </tr>
   </table>
        </div>
		
		
		
		
		
		
		
		
        <div id="m-text-2_banner">
          <ul>
          
           
            <li><?php echo $nidname;?>相簿管理->增加</li>
          </ul>
        </div><div id="m-text-2"></td>
   </tr>
   </table>
   
   
   
   
   <?php 
   $nid=make_safe($_GET["nid"]); 
   $action=make_safe($_GET["action"]); 
   $title=make_safe($_POST["title"]); 
   
   $content=make_safe($_POST["content"]); 
   $BigClassName=make_safe($_GET["BigClassName"]);
   if($BigClassName==""){ $BigClassName=make_safe($_POST["BigClassName"]); }
   
   $addtime=$data3;
  $path =  "upfiles/tmp/".$_POST['ajaxf_images'];
   $type=strstr($path,'.');
   $path2 = "upfiles/".$data."1".$type;
   $type=strtolower($type); 
   
   
   if($action=="add"){
   
   if($type==".jpg"  or $type==".jpge" or $type==".jpeg" or $type==".gif" or $type==".doc" or $type==".xls" or $type==".bmp" or $type==".pdf" ){
//move_uploaded_file($_FILES['images']['tmp_name'],"../".$path2);
copy("../".$path,"../".$path2);
	unlink("../".$path);
}//上传图片
else
{
$path2="";
}
  
  
   $sql="Insert Into product (title,entitle,content,nid,BigClassName,enBigClassName,addtime,images) Values('$title','$entitle','$content','$nid','$BigClassName','$enBigClassName','$addtime','$path2')";
$result=mysql_query($sql);

echo "<script> alert('增加成功！');window.location.href='working.php?nid=$nid&BigClassName=$BigClassName';</script>";
   
   
   
   
   }
   
   
   ?>
   
   
   
   
    
   
   
   <form action="?action=add&nid=<?php echo $nid;?>" method="post" enctype="multipart/form-data" target="_self">
        <table border="0" cellpadding="0" cellspacing="0" class="m-text-2-imp">
          <tr>
            <td class="m-text-2-con2">相簿名稱：
             
              <input name="title" type="text"  size="30" /></td>
            <td class="m-text-2-con3">&nbsp;</td>
          </tr>	  
		  
        </table>
		
		
	
				<script language="javascript">
			$(function(){
				$(".uploadifyupload").each(function(){
					var current_id = $(this).attr('id');
					var previous_img_id = current_id + '_img';
					$(this).uploadify({
						'uploader': 'uploadify/uploadify.swf',
						'cancelImg': 'uploadify/cancel.png',
						'script': 'upload.php',
						'folder': 'files',
						'buttonText':'Choose',
						'multi': false,
						'fileExt':'*.jpg;*.jpeg;*.gif;*.png',
  						'fileDesc':'Image Files',
						'auto': true,
						'queueSizeLimit':1,
						'scriptData':{'<?php echo session_name();?>':'<?php echo session_id();?>','name':$(this).attr('name'),'responsetype':'sizeinfo'},
						'displayData': 'speed',
						'onComplete':function(event,queueID,fileObj,response,data){
							var responseObj = eval("("+response+")");
							var fileName = responseObj.name;
							$('#'+previous_img_id).attr('src','../upfiles/tmp/' + fileName);
							$('input[name=ajaxf_'+current_id+']').val(fileName);
							
						},
						'onError':function(event,queueId,fileObj,errorObj){
							alert(errorObj);
						}
					});
				});
			});
		</script>
		<table border="0" cellpadding="0" cellspacing="0" class="m-text-2-imp">
			<tr>
            <td class="m-text-2-con2">

 				<img id="images_img" src="../pic/blank.gif"  height="160" border="0"  />
              </td>
            <td class="m-text-2-con3">&nbsp;</td>
          </tr>
          <tr>
            <td class="m-text-2-con2">上傳圖片：
             <input type="hidden" name="ajaxf_images" value=""/>
              <input id="images" name="images" type="file"  size="60" class="uploadifyupload"></td>
            <td class="m-text-2-con3">&nbsp;</td>
          </tr>	  
		  
        </table>
		
        <table border="0" cellpadding="0" cellspacing="0" class="m-text-2-imp">
          <tr>
            <td class="m-text-2-con2">選擇相簿類別：
              <label for="select"></label>
              <select name="BigClassName" >
			  
			  <?php
  $n=1;

  $sql="select * from product_type_big where nid='$nid' order by orderid  ";			
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
	?>
    
	 <option  value="<?php echo $row->BigClassName;?>"   <?php if($BigClassName==$row->BigClassName){echo "selected";}?>><?php echo $row->BigClassName;?></option>
	
     <?php }?>
			  
                
              </select>              
              <label for="textfield2"></label></td>
            <td class="m-text-2-con3"><input type="submit" name="button2" id="button2" value="新增" /></td>
          </tr>
        </table>
   </form>
        </div>
      </div>
    </div>
  </div>
</div>
<div id="botton"><div id="copyright"><table border="0" cellpadding="0" cellspacing="0" class="copy">
  <tr>
    <td>© COPYRIGHTS 2010 INC. APARTMENT STUDIO All rights reserved.</td>
  </tr>
</table>
</div></div>
</body>
</html>